﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using System.Collections.ObjectModel;

namespace LifeTree.DomainModel.Entities
{
    public class Workbook : Entity
    {
        public Workbook()
        {
        }

        [Required]
        [StringLength(20, MinimumLength = 3)]
        public string Name { get; set; }

        public virtual ICollection<Task> Tasks { get; set; }

        public Task GetActiveTask() 
        {
            return Tasks.FirstOrDefault(t => t.Status == TaskStatuses.Active);
        }
    }
}
